<?php 
function ShopBuildRoute( &$query ) {
   $segments = array();
   if(isset($query['view']))
   {
        $segments[] = $query['view'];
        unset( $query['view'] );
   }
   if(isset($query['type']))
   {
        $segments[] = $query['type'];
        unset( $query['type'] );
   }
   if(isset($query['id']))
   {
        $segments[] = $query['id'];
        unset( $query['id'] );
   };
    if(isset($query['layout']))
   {
        $segments[] = $query['layout'];
        unset( $query['layout'] );
   };
   return $segments;
}

function ShopParseRoute( $segments ) {
   $vars = array();
   switch($segments[0]) {
       case 'detail':
               $vars['view'] = 'detail';
               $id = explode( ':', $segments[1] );
               $vars['id'] = (int) $id[0];
               break;
       case 'order':
               $vars['view'] = 'order';
               $id = explode( ':', $segments[1] );
               $vars['id'] = (int) $id[0];
               break;
		case 'category':
               $vars['view'] = 'category';
               $id = explode( ':', $segments[1] );
               $vars['id'] = (int) $id[0];
               break;
	case 'noidung':
               $vars['view'] = 'noidung';
               $id = explode( ':', $segments[1] );
               $vars['id'] = (int) $id[0];
               break;
		case 'employer':
               $vars['view'] = 'employer';
               $id = explode( ':', $segments[1] );
               $vars['id'] = (int) $id[0];
               break;
		case 'company':
               $vars['view'] = 'company';
               $id = explode( ':', $segments[1] );
               $vars['id'] = (int) $id[0];
               break;
		case 'cart':
				$vars['view'] = 'cart';
				$vars['layout'] = $segments[1] ;
				break;
		case 'process':
			$vars['view'] = 'process';
			$vars['type'] = $segments[1];
			$vars['id']  = $segments[2];
		break;
   }
   return $vars;
}


?>